package com.czxy.demo07;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.Scanner;

public class Test01 {

    public static void main(String[] args) {
        Random rd=new Random();
        Scanner sc=new Scanner(System.in);
        List<Integer> list=new ArrayList<>();
        int num=0;
        int count=0;
        while (true){
            System.out.println("1 发牌");
            System.out.println("2 结束发牌");
            int s = sc.nextInt();
            if (s==1){
                int a= rd.nextInt(13)+1;
                num+=a;
                count++;
                list.add(a);

                if (num<=21){
                    System.out.println("您手上的牌有"+list+"点数和是"+num);
                }else {
                    System.out.println("点数为"+num+"大于21结束游戏");
                    break;
                }
            }else {
                System.out.println("您手上的牌有"+list+"点数和是"+num);
            }
        }
    }
}
